<template>
	<view>
		<!-- 提现记录 -->
		<view class="bg-white radius" v-for="(item, index) in list" :key="index">
			<view class="margin-sm padding-tb-xs solids-bottom padding-left">提现账号：{{ item.payeeAddress }}</view>
			<view class="margin-sm padding-bottom-xs solids-bottom flex">
				<view class="basis-df padding-left">
					提现金额：
					<text class="text-bold text-pink">{{ item.amount, item.currency | FixedCurrency }}</text>
				</view>
				<view class="basis-df">
					提现状态：
					<text class="text-green">{{ item.status | StatusText }}</text>
				</view>
			</view>
			<view class="margin-sm padding-bottom-xs solids-bottom padding-left">申请时间：{{ item.createTime | formatDate }}</view>
			<view class="margin-sm padding-bottom-xs solids-bottom padding-left" v-if="item.status == 'success'">付款时间：{{ item.payDate | formatDate }}</view>
			<view class="padding-bottom-xs"></view>
		</view>
	</view>
</template>

<script>
export default {
	props: {
		list: {
			// 数据列表
			type: Array,
			default() {
				return [];
			}
		}
	},
	filters: {
		FixedCurrency: function(amount, currency) {
			let n = currency == 'CNY' ? 2 : currency == 'BTC' ? 8 : 6;
			let tmp = parseFloat(amount).toFixed(n);
			return isNaN(tmp) ? (n == 2 ? '0.00' : n == 6 ? '0.000000' : '0.00000000') : tmp;
		},
		StatusText: function(value) {
			let flg = '未审核';
			switch (value) {
				case 'not_audited':
					flg = '未审核';
					break;
				case 'audited':
					flg = '已审核';
					break;
				case 'processing':
					flg = '提现处理中';
					break;
				case 'success':
					flg = '成功';
					break;
				case 'fail':
					flg = '失败';
					break;
			}
			return flg;
		}
	}
};
</script>

<style lang="scss">
.p-section {
	background-color: white;
	color: #000000;
	border-radius: 6rpx;
	margin-bottom: 15rpx;
	.f-section {
		display: flex;
		flex-wrap: wrap;
		border-bottom: 1rpx solid rgba(0, 0, 0, 0.1);
		padding-top: 20rpx;
		padding-bottom: 20rpx;
	}
	.s-section {
		padding-top: 20rpx;
		padding-bottom: 20rpx;
		border-bottom: 1rpx solid rgba(0, 0, 0, 0.1);
	}
	.info {
		color: #aaaaaa;
		font-size: 24rpx;
		padding-left: 20rpx;
	}
}
</style>
